package com.fulihui.common.request.web;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.Min;

/**
 * web端分页请求基础类
 * @author: Levon
 * @version: v 0.1 2018-06-08 11:09
 */
@Getter
@Setter
@ApiModel(value = "公用分页请求对象", description = "公用分页请求对象")
public class PageCommonRequest extends CommonRequest {
    
    @ApiModelProperty(value = "当前页")
    @Min(value = 1,message = "page不能小于1")
    private int page = 1;

    @ApiModelProperty(value = "每页条数")
    private int rows = 10;

    public int start() {
        return page > 1 ? (page - 1) * rows : 0;
    }
}
